package com.cdks.wuxiu.api.service.mysql;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cdks.wuxiu.api.mapper.ChatMessageAuditInfoMapper;
import com.cdks.wuxiu.api.util.TimeUtils;
import com.cdks.wuxiu.entity.mysql.ChatMessageAuditInfo;

import org.springframework.stereotype.Service;


/**
 * 聊天消息审核 服务实现类
 */
@Service
public class ChatMessageAuditInfoServiceImpl extends ServiceImpl<ChatMessageAuditInfoMapper, ChatMessageAuditInfo> implements ChatMessageAuditInfoService {
    @Override
    public int saveMessage(long senderId, long recverId, int type, String data, String remark) {
        ChatMessageAuditInfo msgInfo  = new ChatMessageAuditInfo();
        msgInfo.setSenderId(senderId);
        msgInfo.setRecverId(recverId);
        msgInfo.setType(type);
        msgInfo.setCreateTime(TimeUtils.getTimeSecond());
        msgInfo.setContent(data);
        msgInfo.setRemark(remark);

        int ret  = baseMapper.insert(msgInfo);
        if (ret > 0)
        {
            return 0;
        }

        return -1;
    }
}
